export function getByteLen(val) {
    var len = 0;
    for (var i = 0; i < val.length; i++) {
        var a = val.charAt(i);
        if (a.match(/[^\x00-\xff]/ig) != null) {
            len += 2;
        }
        else {
            len += 1;
        }
    }
    return len;
}
// 截取字符串并加上省略号
export function subStrAddSign(val, num, endNum, sign) {
    if (!val) {
        return val;
    }
    var len = 0;
    for (var i = 0; i < val.length; i++) {
        var a = val.charAt(i);
        if (a.match(/[^\x00-\xff]/ig) != null) {
            len += 2;
        }
        else {
            len += 1;
        }
    }
    let tempStr = ''
    if (len > num) {
        tempStr = val.substring(0, endNum) + sign;
    } else {
        tempStr = val;
    }
    return tempStr
}
